<template>
	<view>		
		<u-tabbar
			:value="currentMenu"
			@change="merchantMenu"
			:fixed="true"
			:placeholder="true"
			:safeAreaInsetBottom="true"
		>
			<u-tabbar-item text="首页" icon="home" ></u-tabbar-item>
			<!-- <u-tabbar-item text="信息" icon="email" ></u-tabbar-item> -->
			<u-tabbar-item text="我的" icon="account" ></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		name:"merchantMenu",
		data() {
			return {
				currentMenu : 0,
			};
		},
		mounted:function(){			
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route // 获取当前页面路由，也就是最后一个打开的页面路由
			if( curRoute == "packageShop/merchant/merchant") {
				this.currentMenu = 0 
			}
			// if( curRoute == "packageShop/merchant/infobox") {
			// 	this.currentMenu = 1
			// }
			if( curRoute == "packageShop/merchant/my") {
				this.currentMenu = 1
			}
		},
		methods: {
			merchantMenu(e) {
				if(e == 0) {
					uni.navigateTo({
						url: "/packageShop/merchant/merchant"
					})
				}
				// if(e == 1) {
				// 	uni.navigateTo({
				// 		url: "/packageShop/merchant/infobox"
				// 	})
				// }
				if(e == 1) {
					uni.navigateTo({
						url: "/packageShop/merchant/my"
					})
				}
				this.currentMenu = e
				console.log('1111', e)
			}
		}
	}
</script>

<style>

</style>